home *** CD-ROM | disk | FTP | other *** search
- _WRITABLE INSTRUCTION SET COMPUTERS_
- by Jack J. Woehr
-
- [LISTING ONE]
-
- \ DEREF a' la Warren Abstract Machine
-
- DECIMAL
- 166 OPCODE: WAM-DEREF ( addr1 -- addr2)
-
- 0 :: SOURCE=ALU ALU=B DEST=PC ;; \ RAM pointer := TOS
- 1 :: INC[PC] ;; \ RAM pointer++
- 2 :: SOURCE=RAM ALU=AxnorB ;; \ @RAM pointer == TOS ??
- 3 :: SOURCE=RAM ALU=AxnorB ;; \ test takes 2 cycles
- 4 :: SOURCE=RAM ALU=A DEST=DLO INC[MPC] JMP=11E ;;
- \ Jump to 6 if not equal, 7 if equal. Note that the microprogram counter is
- \ incremented in this instruction. The next microinstruction will branch to
- \the next page. Note also that this microinstruction saved the address pointer
- \in DLO for later use.
-
- 6 :: SOURCE=ALU ALU=B DEST=PC JMP=000 ;;
- \ Re-load RAM pointer with original address, we are continuing
- \ via 0 on the next page, since we have run out of space here.
-
- 7 :: SOURCE=PCSAVE ALU=A+1 DEST=PC JMP=110 ;;
- \ Reload Program Counter, we are leaving via 6 on the next page.
-
- 167 CURRENT-PAGE !
-
- 0 :: SOURCE=RAM ALU=A DEST=DHI ;; \ DHI := tag
- 1 :: SOURCE=DLO ALU=A DEST=PC ;; \ RAM pointer := next addr
- 2 :: SOURCE=RAM ALU=AxnorB ;; \ Compare tags
- 3 :: SOURCE=RAM ALU=AxnorB ;; \ Comparison takes two cycles
- 4 :: SOURCE=DLO ALU=A DEST=DHI JMP=11E ;; ( Jump = 6+boolean)
- \ Jump to 6 is tags were equal, to 7 if different. This microinstruction loads
- \ DHI (top of stack) with the current address under examination. Therefore, if
- \ this instruction is re-entered, it will have same entry conditions as
- \ previously, but starting at the next reference in the chain.
-
- \ This is the exit pointed to by both microinstruction 7 on previous microcode
- \ page, and by the conditional branch in instruction 4 on this page.
- 6 :: SOURCE=PCSAVE ALU=A+1 DEST=PC INC[MPC] JMP=101 ;;
-
- \ Our exit is long and tortuous! We are exiting via 0 on the next page.
- 5 :: JMP=000 ;;
- \ This microinstruction is the exit for both 6 and 7.
-
- \ This is where "different tags" takes us ... we "fool" the CPU/16
- \ into re-executing with original PC value.
- 7 :: SOURCE=PCSAVE ALU=A DEST=PC INC[MPC] JMP=101 ;;
- \ We are looping by reloading Program Counter with the same address
- \ as it contained at entry. But again we are out of room on this
- \ microcode page, so we must finish on the next microcode page.
-
- 168 CURRENT-PAGE ! \ Increment microcode page under compilation.
-
- 0 :: DECODE ;; \ Latch new program counter value.
- 1 :: END ;; \ Exit to next instruction.
-
- ;;END
-